package com.example.app.moudle.home.adapter

import android.content.Context
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.chad.library.adapter4.BaseQuickAdapter
import com.example.app.databinding.ItemHomeRecommendBinding
import com.libcommon.GlideManager

/**
 * Created on 2023/1/31.
 * @author Joker
 * Des: 单布局
 */

class VHHomeItemRecommend(
    parent: ViewGroup,
    binding: ItemHomeRecommendBinding = ItemHomeRecommendBinding.inflate(LayoutInflater.from(parent.context), parent, false)
) : RecyclerView.ViewHolder(binding.root)

class HomeRecommendAdapter : BaseQuickAdapter<String, VHHomeItemRecommend>() {
    override fun onCreateViewHolder(context: Context, parent: ViewGroup, viewType: Int) = VHHomeItemRecommend(parent)

    override fun onBindViewHolder(holder: VHHomeItemRecommend, position: Int, item: String?) {
        ItemHomeRecommendBinding.bind(holder.itemView).apply {
            GlideManager.loadImage(context, item, ivBg)
        }
    }
}